<template>
	<view class=" main-bgH   ">
		<navigationBar></navigationBar>
		<!-- 	<image mode="widthFix" style="width: 200rpx;height: auto;left: 50rpx;" class="abs" src="@/static/logo.png"> -->
		</image>
		<view class="p-t-90 flex  fd-c ai-c">
			<!-- 		<image class="" style="width: 245rpx;" mode="widthFix"
				src="https://data-h5.oss-cn-shenzhen.aliyuncs.com/yang/2025/0311/btsh/hyxhl.png"> -->

			<!-- 	<view class="fw-400"
				style="font-size: 60rpx;color: #242021;width: 504rpx;border-bottom: 3rpx solid #000000; line-height: 100rpx;"> -->
			<view class="fw-400" style="font-size: 60rpx;color: #242021;width: 504rpx;">
				烨有新活力</view>
			<view class="" style="width: 80rpx;background-color: #000;height: 4rpx;margin-top: 26rpx;">

			</view>

			<view class="rel" style="width: 650rpx; margin-top: 66rpx;">
				<image class="" style="width: 650rpx; " mode="widthFix" @click="tohd2"
					src="https://data-h5.oss-cn-shenzhen.aliyuncs.com/yang/2025/0311/btsh/z4.png">
					<image v-if="dongfeng"
						src="https://data-h5.oss-cn-shenzhen.aliyuncs.com/yang/2025/0311/btsh/ydk.png" mode="widthFix"
						style="width: 98rpx; top: 0; right: 0;" class="abs"></image>
			</view>
			<view class="rel" style="width: 650rpx; margin: 42rpx 0 80rpx;">
				<image class="" style="width: 650rpx; " @click="tohd3" mode="widthFix"
					src="https://data-h5.oss-cn-shenzhen.aliyuncs.com/yang/2025/0311/btsh/z3.png">
					<image v-if="guangqi" src="https://data-h5.oss-cn-shenzhen.aliyuncs.com/yang/2025/0311/btsh/ydk.png"
						mode="widthFix" style="width: 98rpx; top: 0; right: 0;" class="abs"></image>
			</view>


			<!-- 
			<view class="fs-24  fw-400"
				style="text-align: center;line-height: 40rpx;color: #ffffff;letter-spacing: 2rpx; ">
				根据喜好选择 <br>
				烨S7 / P7任意一款车型<br>
				选择关键词生成专属车型海报<br></view> -->
			<view  class="fs-24  fw-400"
				style="text-align: center;line-height: 40rpx;color: #242021;letter-spacing: 2rpx; width: ;">
				根据指引完成区域互动，获得精美海报 <br>
				发布朋友圈，点亮1闪耀值</view>
		</view>


		<!-- 	<view @click="ceshi" mode="widthFix"
			style="width: 322rpx;height: 67rpx; bottom: 10vh;border-radius: 7rpx; line-height: 67rpx;letter-spacing: 4rpx;"
			class="abs-x bg-fff">测试</view> -->

		<pop :visible.sync="popshow" :maskClickClose="true">

			<view class="bg-fff c-000"
				style="width: 84vw;height: 54vw; border-radius: 10rpx; ">
				<view class="fw-b " style="font-size: 5.5vw;letter-spacing: 1vw;padding-top:6vw; ">
					活动登录
				</view>
				<view class="fs-30 " style="font-weight: 300;font-size: 4vw;letter-spacing:0.2vw;margin-top:7.5vw;white-space: nowrap;">
					继续参与活动需要登录授权
				</view>

				<view class="f jc-b ai-c"  style="width:68vw;margin: auto;margin-top:12vw;">
					<view @click="fanhui"
						style="width: 45%;height: 8vw;line-height: 8vw;font-size:4vw; font-weight: normal;border-radius:10vw;box-sizing: border-box; display: inline-flex; letter-spacing: 1px;background: #739AEF;color: #eee;"
						class="jc-c ai-c">前往授权</view>
					<view @click="popshowTap"
						style="width: 45%;height: 8vw;line-height: 8vw;font-size:4vw; font-weight: normal;border-radius:10vw;box-sizing: border-box; display: inline-flex; letter-spacing: 1px;background: #fff;color: #CCCCCC;border: 1px solid #D6D6D6;"
						class="jc-c ai-c">暂不登录</view>
				</view>
			</view>

		</pop>
	</view>
</template>

<script>
	const wx = require('jweixin-module');


	import pop from "@/components/pop.vue"
	import navigationBar from "@/components/navigationBar.vue"
	
	export default {
		data() {
			return {
				dongfeng: false,
				guangqi: false,

				// popshow: true,
				popshow: false,
			}
		},
		components: {
			"navigationBar": navigationBar,
			pop,
		},
		onShow() {

			let user = this.getUrlParam("user") ? this.getUrlParam("user") : ""
			console.log("user++++")
			console.log(user)
			if (user != "") {

				uni.setStorageSync('openid', user);

				console.log(user)
				this.checkIn()

			} else {
				// this.popshow = true
				// uni.showModal({
				// 	title: "用户编码为空"
				// })
			}

		},
		methods: {
			popshowTap() {
				this.popshow = false
			},
			fanhui() {
				console.log("123")
				wx.miniProgram.navigateTo({
					url: "/pages/new/actRule/index"
				});
			},
			checkIn() {
				let param = {
					openid: uni.getStorageSync('openid')
				}
				this.$http.get('/TakePhoto/checkIn', param, res => {
					console.log(res)
					this.checkInData = res.data

					this.dongfeng = this.checkInData.s7 == '' ? false : true;
					this.guangqi = this.checkInData.p7 == '' ? false : true;


					uni.setStorageSync('checkIn', res.data);
				})
			},


			//获取地址栏的参数
			getUrlParam(name) {

				console.log(window.location.href)


				var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
				var r = window.location.search.substr(1).match(reg);
				if (r != null) return unescape(r[2]);
				return null;
			},
			ceshi() {
				// 网页内跳转时携带参数
				window.location.href = 'https://emweb.easys.co/backend/web/index.php?r=site%2Flogin';
			},
			tohd2() {
				let user = this.getUrlParam("user") ? this.getUrlParam("user") : ""
				console.log("user++++")
				console.log(user)
				if (user == "") {

					this.popshow = true

					return
				} 

				if (!this.dongfeng) {

					uni.navigateTo({
						url: "/pages/hudong1_2/hudong1_2?id=1&keyText=" + this.checkInData.s7
					})

					return
				}
				// uni.navigateTo({
				// 	url: "/pages/hudong1_2/hudong1_2?id=1"
				// })
			},
			tohd3() {
				let user = this.getUrlParam("user") ? this.getUrlParam("user") : ""
				console.log("user++++")
				console.log(user)
				if (user == "") {

					this.popshow = true
					return
				} 
				// uni.showModal({
				// 	title: "暂无该素材",
				// })
				// return
				if (!this.guangqi) {

					uni.navigateTo({
						url: "/pages/hudong1_2/hudong1_2?id=2&keyText=" + this.checkInData.p7
					})

					return
				}
				// uni.navigateTo({
				// 	url: "/pages/hudong1_2/hudong1_2?id=2"
				// })
			},
		}
	}
</script>

<style>
	.main-bgH {
		width: 100%;
		height: 100%;
		padding: 5vh 50rpx 0;
		position: relative;
		background-image: url('https://data-h5.oss-cn-shenzhen.aliyuncs.com/yang/2025/0311/btsh/bj1.png');
		background-repeat: no-repeat;
		background-size: 100% 100%;

	}
</style>